﻿@{
    ViewBag.Title = "权限树预览";
    Layout = "~/Views/Shared/_LayoutHc.cshtml";
}
<div class="form-wrap">
    <div class="container" style="padding-top:30px">
        <ul id="roleTree"></ul>
    </div>
</div>


<script>
    layui.use('tree', function () {
        $.post("GetRightTree", { belong: "@ViewBag.belong", pId: "@ViewBag.pId" }, function (data) {
            var tree = layui.tree({
                elem: '#roleTree', //指定元素，生成的树放到哪个元素上
                check: '', //勾选风格
                skin: 'as', //设定皮肤
                drag: false,//点击每一项时是否生成提示信息
                checkboxName: 'cb[]',//复选框的name属性值
                checkboxStyle: "",//设置复选框的样式，必须为字符串，css样式怎么写就怎么写
                click: function (item) { //点击节点回调

                },
                onchange: function () {//当当前input发生变化后所执行的回调

                },
                nodes: [ //节点
                    data
                ]
            });
        });

    });
</script>

